package Com.Hupochuan.Dal.Tab;

import java.util.Hashtable;
import java.util.List;
import java.util.Vector;

import Com.Hupochuan.Dal.DBManager.DBManager;
import Com.Hupochuan.Vo.YouLikeMovie;

public class YouLikeMovieTab {
	/*
	 * 本类私有对象
	 */
	private DBManager<YouLikeMovie> dbManager = new DBManager<YouLikeMovie>(YouLikeMovie.class);
	
	/*
	 * 单一实例
	 */
	private YouLikeMovieTab(){}
	private static YouLikeMovieTab youLikeMovieTab = new YouLikeMovieTab();
	public static YouLikeMovieTab getObject(){
		return youLikeMovieTab;
	}
	
	/*
	 * 查询猜你喜欢列表
	 */
	public List<YouLikeMovie> findYouLikeMovieList(){
		
		//参数部分
		List<YouLikeMovie> youLikeMovieList = new Vector<YouLikeMovie>();
		StringBuffer sqlBuff = new StringBuffer();
		Hashtable<String,Object> paraHash = new Hashtable<String,Object>();
		
		//sql语句部分
		sqlBuff.append(" select YouLikeMovie.*, ");
		sqlBuff.append(" 	Movie.name as movieName, ");
		sqlBuff.append(" 	Movie.byname as movieByname, ");
		sqlBuff.append(" 	Movie.logoPath as movieLogoPath ");
		sqlBuff.append(" from YouLikeMovie ");
		sqlBuff.append(" left join Movie on YouLikeMovie.movieId=Movie.id ");
		sqlBuff.append(" order by YouLikeMovie.weight desc,YouLikeMovie.id ");
		
		//执行sql 
		youLikeMovieList = this.dbManager.querySqlReturnVoList(sqlBuff.toString(),paraHash);
		
		//返回列表
		return youLikeMovieList;
	}
}
